package com.kaifamiao.io.d0922;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.stream.Stream;

public class BufferedReaderDemo {

    public static void main(String[] args) {

        try (FileReader reader = new FileReader("d:/io/reader.txt");
             BufferedReader br = new BufferedReader(reader);) {

//           String str = null;
//
//           while( (str = br.readLine()) != null){
//               System.out.println(str);
//           }

            Stream<String> lines = br.lines();

//            lines.forEach(System.out::println);
            lines.forEach(e -> System.out.println(e));



        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
